Creates a new directory on a data medium.
データ記録媒体上に新規ディレクトリを作成します。
MkDir Text As String
MkDir Text As String
Text: Any string expression that specifies the name and path of the directory to be created. You can also use URL notation.
Text: 作成するディレクトリの名前およびパスを指定する文字列表式。またURL 指定を用いることもできます。
If the path is not determined, the directory is created in the current directory.
有効なパスが指定されなかった場合、現在のディレクトリの中に新規ディレクトリが作成されます。
Sub ExampleFileIO
Sub ExampleFileIO
' Example for functions of the file organization
' ファイルを整理するための機能の例
Const sFile1 as String = "file://c|/autoexec.bat"
Const sFile1 as String = "file://c|/autoexec.bat"
Const sDir1 as String = "file://c|/Temp"
Const sDir1 as String = "file://c|/Temp"
Const sSubDir1 as String ="Test"
Const sSubDir1 as String ="Test"
Const sFile2 as String = "Copied.tmp"
Const sFile2 as String = "Copied.tmp"
Const sFile3 as String = "Renamed.tmp"
Const sFile3 as String = "Renamed.tmp"
Dim sFile as String
Dim sFile as String
sFile = sDir1 + "/" + sSubDir1
SFile = sDir1 + "/" + sSubDir1
ChDir( sDir1 )
ChDir( sDir1 )
If Dir(sSubDir1,16)="" then ' Does the directory exist ?
If Dir(sSubDir1,16)="" then ' ディレクトリが存在するかの確認
MkDir sSubDir1
MkDir sSubDir1
MsgBox sFile,0,"Create directory"
MsgBox sFile,0,"Create directory"
End If
End If
sFile = sFile + "/" + sFile2
SFile = sFile + "/" + sFile2
FileCopy sFile1 , sFile
FileCopy sFile1 , sFile
MsgBox fSysURL(CurDir()),0,"Current directory"
MsgBox fSysURL(CurDir()),0,"Current directory"
MsgBox sFile & Chr(13) & FileDateTime( sFile ),0,"Creation time"
MsgBox sFile & Chr(13) & FileDateTime( sFile ),0,"Creation time"
MsgBox sFile & Chr(13)& FileLen( sFile ),0,"File length"
MsgBox sFile & Chr(13)& FileLen( sFile ),0,"ファイルサイズ"
MsgBox sFile & Chr(13)& GetAttr( sFile ),0,"File attributes"
MsgBox sFile & Chr(13)& GetAttr( sFile ),0,"ファイル属性"
Name sFile as sDir1 + "/" + sSubDir1 + "/" + sFile3
Name sFile as sDir1 + "/" + sSubDir1 + "/" + sFile3
' Rename in the same directory
' 同一ディレクトリ内で名前を変更
sFile = sDir1 + "/" + sSubDir1 + "/" + sFile3
sFile = sDir1 + "/" + sSubDir1 + "/" + sFile3
SetAttr( sFile, 0 ) 'Delete all attributes
SetAttr( sFile, 0 ) 'すべての属性の削除
MsgBox sFile & Chr(13) & GetAttr( sFile ),0,"New file attributes"
MsgBox sFile & Chr(13) & GetAttr( sFile ),0,"New file attributes"
Kill sFile
Kill sFile
RmDir sDir1 + "/" + sSubDir1
RmDir sDir1 + "/" + sSubDir1
end sub
end sub
' Converts a system path in URL
' システムパスを URL に変換
Function fSysURL( fSysFp as String ) as String
Function fSysURL( fSysFp as String ) as String
Dim iPos As String
Dim iPos As String
iPos = 1
IPos = 1
iPos = Instr(iPos,fSysFp, getPathSeparator())
IPos = Instr(iPos,fSysFp, getPathSeparator())
do while iPos > 0
do while iPos > 0
mid( fSysFp, iPos , 1,"/")
mid( fSysFp, iPos , 1,"/")
iPos = Instr(iPos+1,fSysFp, getPathSeparator())
iPos = Instr(iPos+1,fSysFp, getPathSeparator())
loop
Loop
' the colon with DOS
' DOS のコロン処理
iPos = Instr(1,fSysFp,":")
iPos = Instr(1,fSysFp,":")
if iPos > 0 then mid( fSysFp, iPos , 1,"|")
if iPos > 0 then mid( fSysFp, iPos , 1,"|")
fSysURL = "file://" & fSysFp
fSysURL = "file://" & fSysFp
End Function
End Function